﻿<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="2.0"
	xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
	xmlns:xs="http://www.w3.org/2001/XMLSchema"
	xmlns:fn="http://www.w3.org/2005/xpath-functions">
<!--
程序名:参数初始化生成工具
版本号    修改者    修改时间    修改描述
1.0       liuleyi   20150609    创建此程序
-->
	<xsl:output method="text" indent="no" encoding="utf-8" byte-order-mark="no"/>  
	<xsl:template match="/">

<xsl:result-document encoding="utf-8" method="text" href="./generate/sql/InitData/init_Parameter.sql">
/*
参数初始化脚本
*/
<xsl:for-each select="Root">
<xsl:for-each select="Lccode">
<xsl:variable name="LcCode" select="@code"/>
DELETE t_mc_parameter where lccode='<xsl:value-of select="$LcCode"/>';
DELETE t_mc_parameter_dict where lccode='<xsl:value-of select="$LcCode"/>';
<xsl:for-each select="System">
<xsl:variable name="SystemType" select="@type"/>
<xsl:for-each select="BusinessCenter">
<xsl:variable name="BusinessCenterCode" select="@code"/>
<xsl:for-each select="Module">
<xsl:variable name="ModuleCode" select="@code"/>
<xsl:for-each select="Parameter">
<xsl:variable name="ParaCode" select="@code"/>
<xsl:variable name="SeatCode" select="@seatcode"/>
INSERT INTO t_mc_parameter(lccode,systemtype,businesscentercode,appmodeltype,seatcode,paracode,paraname,paravalue,defaultparavalue,updateoperid,updatedate,updatetime) values('<xsl:value-of select="$LcCode"/>','<xsl:value-of select="$SystemType"/>','<xsl:value-of select="$BusinessCenterCode"/>','<xsl:value-of select="$ModuleCode"/>','<xsl:value-of select="$SeatCode"/>','<xsl:value-of select="$ParaCode"/>','<xsl:value-of select="@desc"/>',null,'<xsl:value-of select="@defaultvalue"/>','SSS',Pkg_Tool.Getoperdate(),Pkg_Tool.Getopertime());
<xsl:for-each select="ParaDict">
INSERT INTO t_mc_parameter_dict(lccode,systemtype,businesscentercode,appmodeltype,seatcode,paracode,paradict,paradictdesc,updateoperid,updatedate,updatetime)values('<xsl:value-of select="$LcCode"/>','<xsl:value-of select="$SystemType"/>','<xsl:value-of select="$BusinessCenterCode"/>','<xsl:value-of select="$ModuleCode"/>','<xsl:value-of select="$SeatCode"/>','<xsl:value-of select="$ParaCode"/>','<xsl:value-of select="@dict"/>','<xsl:value-of select="@desc"/>','SSS',Pkg_Tool.Getoperdate(),Pkg_Tool.Getopertime());
</xsl:for-each>
</xsl:for-each>
</xsl:for-each>
</xsl:for-each>
</xsl:for-each>
</xsl:for-each>
</xsl:for-each>
COMMIT;
</xsl:result-document>
	</xsl:template>  
</xsl:stylesheet>